<%--
  Created by IntelliJ IDEA.
  User: fengdefangxiang
  Date: 2022/2/9
  Time: 11:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <%@ include file="/web/header.jsp" %>
    <style>
        body {
            background: url('<%=app%>/web/base/img/添改.jpg') no-repeat;
            background-size: cover;
        }
    </style>
</head>
<body class="body">
<fieldset class="layui-elem-field" style="margin: 10px">
    <legend>更改项目信息</legend>
    <div class="layui-field-box">
        <form class="layui-form layui-form-pane" lay-filter="formA">
            <div class="layui-form-item">
                <label class="layui-form-label">项目编号</label>
                <div class="layui-input-block">
                    <input type="text" name="code" readonly
                           lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">项目名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" readonly
                           lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">开启时间</label>
                <div class="layui-input-block">
                    <input type="text" id="startTime" name="startTime" placeholder="请选择项目开启时间"
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-block">
                    <input type="text" id="endTime" name="endTime" placeholder="请选择项目结束时间"
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="button" value="确定" class="layui-btn layui-btn-radius" lay-submit lay-filter="add">
                    <input type="reset" value="重置" class="layui-btn layui-btn-radius layui-btn-warm">
                </div>
                <input type="button" value="关闭" class="layui-btn layui-btn-radius layui-btn-danger"
                       onclick="layerClose()">
            </div>
            <input type="hidden" name="action" value="updTime">
        </form>
    </div>
</fieldset>

<script type="text/javascript">
    var laydate = layui.laydate;
    function renderDate(id) {
        laydate.render({
            elem: "#" + id,
            type: "date",
            theme: '#56EBA0'
        })
    }
    renderDate("startTime")
    renderDate("endTime")

    var code = '<%=request.getParameter("code")%>';
    //layer.msg(code)
    function init() {
        ajax("/ProjectServlet", {code: code, action: 'get'}, 'json', function (data) {//console.log(data)
            form.val("formA", data)
        })
    }

    init();	//打开这个界面时就会调用

    formOnSubmit("add", '/ProjectServlet', 'text', function (data) {
// 	console.log(data.field)
        if (data == 1) {
            layer.msg("更改成功", {shift: -1, time: 2000, icon: 6}, layerClose)
        } else {
            layer.msg("更改失败", {icon: 5})
        }
    })



</script>

</body>
</html>